/**
 * 设置token信息
 * @param token
 */
export const setToken = (token: string, timeout: number) => {
  window.localStorage.setItem("token", token);
};
/**
 * 获取token信息
 * @returns {string}
 */
export const getToken = (): string => {
  const token = window.localStorage.getItem("token");
  return token ? token : "";
};
/**
 * 清理token
 */
export const clearToken = () => {
  return window.localStorage.removeItem("token");
};
export const clearAllToken = () => {
  clearToken();
  clearRefreshToken();
};
export const setRefreshToken = (token: string, timeout: number) => {
  window.localStorage.setItem("RefreshToken", token);
};
export const getRefreshToken = () => {
  return window.localStorage.getItem("RefreshToken");
};
export const clearRefreshToken = () => {
  return window.localStorage.removeItem("RefreshToken");
};
export default {
  setToken,
  getToken,
  clearToken,
  setRefreshToken,
  getRefreshToken,
  clearRefreshToken,
  clearAllToken
};
